from wsgiref.simple_server import  make_server

def app(env,make_response):
    for k,v in env.items():
        print(k,':', v)
    #生成响应头信息
    make_response('200 OK',[('Content-type','text/html;charset=utf-8')])
    return ['<h3>Hi,WSGI</h3>'.encode('utf-8')]
host = '0.0.0.0'
port = 8000
httpd = make_server(host,port,app)
print(f'running http://%s:%s'%(host,port))
httpd.serve_forever()